﻿@namespace MudBlazor
@inherits MudComponentBase

@{
#nullable enable
}

<MudDialog @attributes="UserAttributes" Class="@Classname">
    <TitleContent>
        @if (TitleContent is null)
        {
            <MudText Typo="Typo.h6">@Title</MudText>
        }
        else
        {
            @TitleContent
        }
    </TitleContent>
    <DialogContent>
        @if (MessageContent is not null)
        {
            @MessageContent
        }
        else
        {
            @MarkupMessage
            @Message
        }
    </DialogContent>
    <DialogActions>
        <div tabindex="-1" class="d-contents">
            <MudFocusTrap DefaultFocus="DefaultFocus.LastChild">
                @if (CancelButton is not null)
                {
                    <CascadingValue Value="@_cancelCallback">
                        @CancelButton
                    </CascadingValue>
                }
                else if (!string.IsNullOrWhiteSpace(CancelText))
                {
                    <MudButton Class="mud-message-box__cancel-button" OnClick="OnCancelClicked">@CancelText</MudButton>
                }
                @if (NoButton is not null)
                {
                    <CascadingValue Value="@_noCallback">
                        @NoButton
                    </CascadingValue>
                }
                else if (!string.IsNullOrWhiteSpace(NoText))
                {
                    <MudButton Class="mud-message-box__no-button" OnClick="OnNoClicked">@NoText</MudButton>
                }
                @if (YesButton is not null)
                {
                    <CascadingValue Value="@_yesCallback">
                        @YesButton
                    </CascadingValue>
                }
                else if (!string.IsNullOrWhiteSpace(YesText))
                {
                    <MudButton Class="mud-message-box__yes-button" Color="Color.Primary" OnClick="OnYesClicked">@YesText</MudButton>
                }
            </MudFocusTrap>
        </div>

    </DialogActions>
</MudDialog>
